Skip to content

Feat: Funding Pot #741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 126 commits into
base: dev
Choose a base branch
from
Open

Feat: Funding Pot #741

wants to merge 126 commits into from

Conversation

fabianschu
Copy link
Contributor

No description provided.

@fabianschu fabianschu requested a review from 0xNuggan April 30, 2025 22:37
}

if (block.timestamp > round_.roundStart) {
revert Module__LM_PC_FundingPot__RoundAlreadyStarted();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit of a nitpick, but since this will also trigger if somebody tries to edit an already finished round, maybe we can change the name (or add an extra error if size allows for it?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't really come up with a more descriptive error since the idea is that the admin can edit as long as a round hasn't started. Imo the error exactly tells this story.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, fair. My comment came from the thought of "if a round started and ended, it's weird to revert saying 'it started' ". But it makes sense, the condition is "rounds are editable before start". Let's leavi it like that.

Copy link
Contributor

@0xNuggan 0xNuggan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general looks good, there are a couple of things I pointed out. I also have still an open question about the caps/accesstypes, but I wanted to get this out first

@fabianschu fabianschu requested a review from 0xNuggan May 22, 2025 15:35
}

if (block.timestamp > round_.roundStart) {
revert Module__LM_PC_FundingPot__RoundAlreadyStarted();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, fair. My comment came from the thought of "if a round started and ended, it's weird to revert saying 'it started' ". But it makes sense, the condition is "rounds are editable before start". Let's leavi it like that.

// Constants

/// @notice The role that allows creating funding rounds.
bytes32 public constant FUNDING_POT_ADMIN_ROLE = "FUNDING_POT_ADMIN";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will need to update it for the new authorization logic

}

/// @inheritdoc ILM_PC_FundingPot_v1
function getRoundAccessCriteria(uint32 roundId_, uint8 accessCriteriaId_)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should revert if the roundId_ or its accessCriteriaId_ don't exist

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Unless returning all empty over revert is intended)

) external onlyModuleRole(FUNDING_POT_ADMIN_ROLE) {
Round storage round = rounds[roundId_];

if (accessCriteriaType_ > MAX_ACCESS_CRITERIA_ID) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it checks against the type not the id. According to the name and other uses of MAX_ACCESS_CRITERIA_ID, it should both check here against accessCriteriaId_ instead of accessCriteriaType_, and in if accessCriteriaId_ is 0 it should check roundIdToNextAccessCriteriaId won't be higher.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though it's a bit unclear why require it to be up to 4?
Was that meant to be limiting the type or the ID in fact?

// Clear all existing data to prevent stale data
round.accessCriterias[criteriaId].nftContract = address(0);
round.accessCriterias[criteriaId].merkleRoot = bytes32(0);
// @note: When changing allowlists, call removeAllowlistedAddresses first to clear previous entries

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be called here then to make sure it's removed?

_validateEditRoundParameters(round);

for (uint i = 0; i < addressesToRemove_.length; i++) {
unchecked {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this unchecked for? (there's no math operation inside here)

Module__LM_PC_FundingPot__UnspentCapsRoundIdsNotStrictlyIncreasing(
);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could move lastSeenRoundId = currentProcessingRoundId; here and delete it from the 3 other places it's done below to avoid code repetition.

{
Round storage round = rounds[roundId_];

if (round.roundEnd == 0 && round.roundCap == 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this, you could just check if the round ID is lower than the current one in the counter (here and in other places this check is done)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or check roundStart != 0 as it cannot be 0 when a round is added

uint contributorCount = contributors.length;

// Check batch size is not zero
if (batchSize_ == 0 || batchSize_ > contributorCount) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make operations more convenient to set batchSize_ to contributorCount instead of reverting if it's bigger

}

// --- Personal Cap Check ---
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have an if here to check if personal cap exists/ should be applied

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants